﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OAuth2.Framework;
using OAuth2.Repository.Model;

namespace OAuth2.Repository
{
    public class InMemoryClientRespository:IClientRepository
    {
        static readonly IDictionary<string, Client> _clients = new Dictionary<string, Client>();

        static InMemoryClientRespository() 
        {
            _clients.Add("10001", new Client() {
                Name="InMemoryClient",
                ClientID="10001",
                ClientSecret="secret",
                RedirectUri=new Uri("http://localhost:15075/Home/Callback",UriKind.Absolute)
            });
        }

        #region IClientRepository 成员

        public Client FindClient(string clientID)
        {
            if (!_clients.ContainsKey(clientID)) return null;
            return _clients[clientID];
        }

        #endregion
    }
}
